﻿using Ninject;

namespace InseSoft.Infraestructure
{
    public static class DIFactory
    {
        public static IKernel Kernel { get; set; }

        public static T Get<T>()
        {
            if (Kernel == null)
                Kernel = CreateKernel();
            return Kernel.Get<T>();
        }
        
        private static IKernel CreateKernel()
        {
            var module = new MyNinjectModule();
            return new StandardKernel(module);
        }
    }
}
